package com.oracle.oa.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


@Entity                        
@Table(name="schedule")
public class Schedule  implements java.io.Serializable {

	 private static final long serialVersionUID = 1L;
	 @GenericGenerator(name = "generator", strategy = "increment")
	 @Id
	 @GeneratedValue(generator = "generator")
	 @Column(name = "scheduleid", unique = true, nullable = false)       
     private int scheduleid;
	 @ManyToOne
	 @JoinColumn(name = "departinfo_id")
     private Departinfo departinfo;
	 @ManyToOne
	 @JoinColumn(name = "userinfo_id")
     private Userinfo userinfo;
	 @ManyToOne
	 @JoinColumn(name = "calendar_id")
     private Calendar calendar;
	 
	 @Column(name = "ifprivate")
     private int ifprivate;
	 
	 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set precontracts = new HashSet(0);
	
	 public int getScheduleid() {
		return scheduleid;
	 }
	 public void setScheduleid(int scheduleid) {
		this.scheduleid = scheduleid;
	 }
	 public Departinfo getDepartinfo() {
		return departinfo;
	 }
	public void setDepartinfo(Departinfo departinfo) {
		this.departinfo = departinfo;
	}
	public Userinfo getUserinfo() {
		return userinfo;
	}
	public void setUserinfo(Userinfo userinfo) {
		this.userinfo = userinfo;
	}
	public Calendar getCalendar() {
		return calendar;
	}
	public void setCalendar(Calendar calendar) {
		this.calendar = calendar;
	}
	public int getIfprivate() {
		return ifprivate;
	}
	public void setIfprivate(int ifprivate) {
		this.ifprivate = ifprivate;
	}
	public Set getPrecontracts() {
		return precontracts;
	}
	public void setPrecontracts(Set precontracts) {
		this.precontracts = precontracts;
	}
	public Schedule(int scheduleid, Departinfo departinfo, Userinfo userinfo,
			Calendar calendar, int ifprivate, Set precontracts) {
		this.scheduleid = scheduleid;
		this.departinfo = departinfo;
		this.userinfo = userinfo;
		this.calendar = calendar;
		this.ifprivate = ifprivate;
		this.precontracts = precontracts;
	}
	
	@Override
	public String toString() {
		return "Schedule [scheduleid=" + scheduleid + ", departinfo="
				+ departinfo + ", userinfo=" + userinfo + ", calendar="
				+ calendar + ", ifprivate=" + ifprivate + ", precontracts="
				+ precontracts + "]";
	}
	public Schedule(Departinfo departinfo, Userinfo userinfo,
			Calendar calendar, int ifprivate, Set precontracts) {
		this.departinfo = departinfo;
		this.userinfo = userinfo;
		this.calendar = calendar;
		this.ifprivate = ifprivate;
		this.precontracts = precontracts;
	}
	public Schedule(Departinfo departinfo, Userinfo userinfo,
			Calendar calendar, int ifprivate) {
		this.departinfo = departinfo;
		this.userinfo = userinfo;
		this.calendar = calendar;
		this.ifprivate = ifprivate;
	}

	
	
}